package com.sky.api.client;

import com.sky.entity.Dish;
import com.sky.entity.Setmeal;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.Map;

@FeignClient("dish-service")
public interface DishClient {
    /**
     * 根据菜品id查询菜品信息
     * @param id
     * @return
     */
    @GetMapping("/user/dish/{id}")
    @ApiOperation("根据菜品id查询菜品信息")
    public Dish getByDishId(@PathVariable Long id);

    @GetMapping("{id}")
    @ApiOperation("根据菜品id查询套餐信息")
    public Setmeal getBySetmealId(@PathVariable Long id);

    /**===================
     * 根据条件统计菜品数量
     * @param map
     * @return
     */
    @PostMapping("/admin/dish/count")
    public Integer dishcountByMap(@RequestBody Map map);

    /**======================
     * 根据条件统计套餐数量
     * @param map
     * @return
     */
    @GetMapping("/admin/dish/count")
    @ApiOperation("根据条件统计套餐数量")
    public Integer setmealcountByMap(@RequestBody Map map);
}
